package com.xukai.springboot.controller.sys;


import com.xukai.springboot.entity.response.ResponseBase;
import com.xukai.springboot.entity.sys.t_sys_datasource_refreshtime;
import com.xukai.springboot.service.sys.DataSourceRefrshTimeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(basePath = "api/sys/datasource/refrshtime", description = "数据源刷新时间设置")
@RestController
@RequestMapping("api/sys/datasource/refrshtime")
public class DataSourceRefrshTimeController {

    /**
     * 日志
     */
    private final Logger logger = LoggerFactory.getLogger(DataSourceRefrshTimeController.class);


    @Autowired
    private DataSourceRefrshTimeService dataSourceRefrshTimeService;


    /**
     * 获取可访问菜单
     *
     * @return
     */
    @ApiOperation(value = "获取数据源刷新设置列表", notes = "获取数据源刷新设置列表")
    @ApiImplicitParams({

    })
    @GetMapping("GetRefrshTimeList")
    public ResponseBase<List<t_sys_datasource_refreshtime>> GetRefrshTimeList() {
        ResponseBase<List<t_sys_datasource_refreshtime>> result = new ResponseBase<>();
        try {

            result.setData(dataSourceRefrshTimeService.GetRefrshTimeList());
        } catch (Exception e) {
            logger.error("获取数据源刷新设置列表", e);
            result.setStatue(0);
        }
        return result;
    }
}
